<?php
class Categorymanager_Model_Updatecategory implements Categorymanager_Model_Mainable{
    
    private $core_controller_notnull;
    private $core_controller_chectoken;
    
    private $excpted_result = 1;
    
    private $categoryadmin_data_updatecategorysettings;
    private $categoryadmin_data_updatecategorymetavalues;
    private $categoryadmin_data_updatecategorycontentvalues;
    
    private $update_category_settings_result;
    private $update_category_meta_values_result;
    private $update_category_content_values_result;
    
    public function main(array $variables = null) {
        $this->core_controller_chectoken = new Core_Controller_Tokencheckout;
        $this->core_controller_chectoken->main($variables['post']);
        //var_dump($variables);
        //die();
        $this->core_controller_notnull = new Core_Controller_Notnull;
        $this->core_controller_notnull->main($variables);
        $this->categoryadmin_data_updatecategorysettings = new Categorymanager_Data_Updatecategorysettings;
        $this->update_category_settings_result = $this->categoryadmin_data_updatecategorysettings->main($variables);
        $this->categoryadmin_data_updatecategorymetavalues = new Categorymanager_Data_Categorymetavaluesupdate;
        $this->update_category_meta_values_result = $this->categoryadmin_data_updatecategorymetavalues->main($variables);
        $this->categoryadmin_data_updatecategorycontentvalues = new Categorymanager_Data_Categorycontentvaluesupdate;
        $this->update_category_content_values_result = $this->categoryadmin_data_updatecategorycontentvalues->main($variables);
        if(
                ($this->update_category_settings_result == $this->excpted_result) &&
                ($this->update_category_content_values_result == $this->excpted_result) &&
                ($this->update_category_meta_values_result == $this->excpted_result)
                ){
                    header("Location: ".SITE_ROOT."zarzadzaj-kategoriami.html");
        }
        else {
            header("Location: ".SITE_ROOT."zarzadzaj-kategoriami.html");
        }
        
    }

}
